package cn.liyicun.cp.cpweb.controller;


import cn.liyicun.cp.cpweb.entity.UserInfo;
import cn.liyicun.cp.cpweb.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Controller
@RequestMapping(value = {"/user"})
public class UserInfoController extends BaseController {

    @Autowired
    UserInfoService userInfoService;

    @RequestMapping(value = "/updateBank")
    public String updateBank(Map<String, Object> map, HttpServletRequest request) {
        Long uid = getLoginById(request,true);
        UserInfo info = userInfoService.getUserInfo(uid);
        map.put("info", info);
        return "user/updateBank";
    }

    @RequestMapping(value = "/changePasswd")
    public String changePasswd(Map<String, Object> map, HttpServletRequest request) {
        Long uid = getLoginById(request,true);
        return "user/changePasswd";
    }


    @RequestMapping(value = "/userInfo")
    public String userInfo(Map<String, Object> map, HttpServletRequest request) {
        Long uid = getLoginById(request,true);
        UserInfo info = userInfoService.getUserInfo(uid);
        map.put("info", info);
        return "user/userInfo";
    }


}
